<template>
    <view class="welcome-container">
        <view class="header">
            <view class="welcomeTitle-container">
                <text class="welcomeTitle">生命故事盒子</text>
                <text class="subwelcomeTitle">记录生命，传递温暖</text>
            </view>
        </view>

        <view class="welcome-content">
            <view class="welcome-image">
                <image class="logo-image" src="/assets/logo.png" mode="aspectFit"></image>
            </view>

            <view class="welcome-message">
                <text class="message-text">欢迎来到生命故事盒子，这里是记录和分享生命故事的地方</text>
            </view>
        </view>

        <view class="action-buttons">
            <button class="login-btn" @click="goToLogin" hover-class="btn-hover">登录</button>
        </view>
        <view class="action-buttons">
            <button class="register-btn" @click="goToRegister" hover-class="btn-hover">创建账户</button>
        </view>

    </view>
</template>

<script>
export default {
    data() {
        return {}
    },
    methods: {
        goToLogin() {
            // 跳转到登录页面
            uni.navigateTo({
                url: '/pages/login/login'
            });
        },
        goToRegister() {
            // 跳转到注册页面 - 注册页面需要创建
            uni.navigateTo({
                url: '/pages/login/register' // 假设注册页面的路径
            });
        }
    }
}
</script>

<style>
.welcome-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 50rpx 40rpx;
    background-image: url('/assets/background1.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    height: 100vh;
    box-sizing: border-box;
    position: relative;
}

/* 添加半透明遮罩，提高文字可读性 */
.welcome-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.3);
    z-index: 0;
}

.header {
    margin-bottom: 60rpx;
    text-align: center;
    padding-top: 60rpx;
    display: flex;
    justify-content: center;
    position: relative;
    z-index: 1;
}

.welcomeTitle-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    animation: fadeIn 1.2s ease-in-out;
}

.welcomeTitle {
    font-size: 72rpx;
    font-weight: bold;
    color: #2e8b57;
    text-shadow: 2rpx 2rpx 4rpx rgba(0, 0, 0, 0.1);
    margin-top: 180rpx;
    margin-bottom: 24rpx;
}

.subwelcomeTitle {
    font-size: 36rpx;
    color: #3cb371;
    margin-top: 10rpx;
    letter-spacing: 2rpx;
}

.welcome-content {
    width: 85%;
    max-width: 650rpx;
    background-color: rgba(255, 255, 255, 0.3);
    border-radius: 24rpx;
    padding: 40rpx;
    box-shadow: 0 8rpx 30rpx rgba(0, 0, 0, 0.1);
    margin-top: 15rpx;
    margin-bottom: 0rpx;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    position: relative;
    z-index: 1;
    animation: slideUp 0.8s ease-out;
    backdrop-filter: blur(5px);
}

.welcome-image {
    margin-bottom: 30rpx;
    animation: pulse 2s infinite ease-in-out;
}

.logo-image {
    width: 180rpx;
    height: 180rpx;
    transition: transform 0.3s ease;
}

.logo-image:active {
    transform: scale(1.05);
}

.welcome-message {
    text-align: center;
}

.message-text {
    font-size: 32rpx;
    color: #555;
    line-height: 1.6;
    letter-spacing: 1rpx;
}

.action-buttons {
    width: 100%;
    max-width: 650rpx;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 30rpx;
    position: relative;
    z-index: 1;
    animation: fadeIn 1s ease-in-out 0.5s both;
    margin-top: 50rpx;
}

.login-btn,
.register-btn {
    height: 88rpx;
    width: 300rpx;
    border-radius: 12rpx;
    font-size: 34rpx;
    font-weight: 500;
    line-height: 88rpx;
    margin-top: 10rpx;
    transition: all 0.3s ease;
    box-shadow: 0 6rpx 16rpx rgba(0, 0, 0, 0.1);
}

.login-btn {
    background-color: #1c6a3e;
    color: #fff;
}

.register-btn {
    background-color: rgba(255, 255, 255, 0.9);
    color: #1c6a3e;
    border: 2rpx solid #1c6a3e;
}

.btn-hover {
    transform: translateY(-3rpx);
    box-shadow: 0 10rpx 20rpx rgba(0, 0, 0, 0.15);
    opacity: 0.9;
}

/* 添加动画 */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(50rpx);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulse {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }

    100% {
        transform: scale(1);
    }
}

/* 适配 iPhone 12 Pro 的媒体查询 */
@media screen and (min-width: 390px) and (max-width: 430px) {

    .welcome-content,
    .action-buttons {
        max-width: 390px;
    }
}

/* 适配竖屏模式 */
@media screen and (max-height: 850px) {
    .header {
        margin-bottom: 40rpx;
        padding-top: 40rpx;
    }

    .welcomeTitle {
        margin-top: 120rpx;
    }

    .welcome-content {
        margin-bottom: 40rpx;
        padding: 30rpx;
    }
}

/* 适配安全区域 */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
    .welcome-container {
        padding-bottom: calc(40rpx + env(safe-area-inset-bottom));
    }
}
</style>